package com.zkkj.demo.singleTon;

import com.google.common.collect.Maps;

import java.util.Map;

/**
 * Created by cyc
 * 2019/12/30 23:15
 * 支付通道单例类，将多种的支付类添加到改单例类中
 */
public class PayChannelSingleTon {

    /**
     * 饿汉式
     */
    private static PayChannelSingleTon instance = new PayChannelSingleTon();

    private PayChannelSingleTon() {
        payChannelMap = Maps.newHashMap();
    }

    private Map<String, String> payChannelMap;

    public static PayChannelSingleTon getInstance() {
        return instance;
    }

    /**
     * 将多种支付方式添加到该属性中
     *
     * @return
     */
    public Map<String, String> getPayChannelMap() {
        payChannelMap.put("aliPay", "com.zkkj.demo.service.impl.AliPayChannelServiceImpl");
        payChannelMap.put("weChatPay", "com.zkkj.demo.service.impl.WeChatPayChannelServiceImpl");
        return payChannelMap;
    }

    public void setPayChannelMap(Map<String, String> payChannelMap) {
        this.payChannelMap = payChannelMap;
    }
}
